﻿using System.Windows.Forms;
using Emgu.CV;
using Emgu.CV.Structure;
using Emgu.CV.UI;

namespace Tracker {
	public partial class Form2 : Form {
		private readonly ImageBox ib = new ImageBox();

		public Form2() {
			InitializeComponent();

			ib.Dock = DockStyle.Fill;
			ib.SizeMode = PictureBoxSizeMode.StretchImage;
			panel1.Controls.Add(ib);
		}

		private void set() {
			var img = new Image<Lab, byte>(256, 256);

			for (int i = 0; i <= 255; i++) {
				for (int j = 0; j <= 255; j++) {
					img.Data[i, j, 0] = (byte)hScrollBar1.Value;
					img.Data[i, j, 1] = (byte)i;
					img.Data[i, j, 2] = (byte)j;
				}
			}

			ib.Image = img;
		}

		private void hScrollBar1_Scroll(object sender, ScrollEventArgs e) {
			set();
		}

		private void hScrollBar2_Scroll(object sender, ScrollEventArgs e) {
			set();
		}

		private void hScrollBar3_Scroll(object sender, ScrollEventArgs e) {
			set();
		}
	}
}